﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ASoft.WPF.View
{
    /// <summary>
    /// LoginInView.xaml 的交互逻辑
    /// </summary>
    public partial class LoginInView : Window
    {
        public LoginInView()
        {
            InitializeComponent();
#if DEBUG
            txtCode.Text = "admin";
            txtPassword.Password = "nimda";
#endif
        }

        private void btnExit_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            this.Close();
        }

        private void btnLogin_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                RC.Current.LoginIn(txtCode.Text, txtPassword.Password);
                MainView mv = new MainView();
                mv.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                lbMsg.Text = ex.Message;
            }
        }
    }
}
